from django.db import models




class InfluxInfo(models.Model):
    objects = models.Manager()
    Name = models.CharField(verbose_name='昵称',max_length=16)
    IP = models.CharField(verbose_name="IP", max_length=16)
    ProjectID = models.CharField(max_length=64)
    IDS = models.CharField(max_length=64)
    Begintime = models.DateTimeField(verbose_name="开始时间")
    Days = models.IntegerField(verbose_name="天数", max_length=16)
    Hours = models.IntegerField(verbose_name="小时",max_length=16)
    Minutes = models.IntegerField(verbose_name="分钟",max_length=16)
    Seconds = models.IntegerField(verbose_name="秒",max_length=16)
    DataType = models.CharField(verbose_name="数据类型",max_length=16)
    BaseNumber = models.IntegerField(verbose_name='基础数',max_length=16)
    RangeNumber = models.IntegerField(verbose_name='浮动范围',max_length=16)
    Step = models.IntegerField(verbose_name='步长',max_length=16)
#
#
#     data_type_choices=(
#         (1,"float"),
#         (2,"Integer"),
#     )
#     data_type = models.SmallIntegerField(verbose_name="类型",choices=data_type_choices)
class UserInfo(models.Model):
    objects = models.Manager()
    name = models.CharField(verbose_name='姓名',max_length=32)
    # password = models.CharField(max_length=64)
    # # age = models.IntegerField()
    # # 默认值
    # age = models.IntegerField(default=2)
    # # 可以为空
    # data = models.IntegerField(null=True, blank=True)
    # creat_time = models.DateTimeField(verbose_name='入职时间')
    # gender_choices = (
    #     (1,"男"),
    #     (2,"女"),
    # )
    # gender = models.SmallIntegerField(verbose_name="性别",choices=gender_choices)
    #1  有约束的外键
    # - to 与那个表关联
    # - to_filed, 表中的哪一列关联
    # 2 Django自动
    #  - 写的depart，生成数据列是 depart_id
    #3 当外键部门被删除了
    # 3.1级联删除， ， 那么员工被级联删除
    # depart = models.ForeignKey(to='Department',to_field="id",on_delete=models.CASCADE)
    # 3.2 置空  前提是这个字段允许为空
    # depart = models.ForeignKey(to='Department',to_field="id",null=True,blank=True, on_delete=models.SET_NULL)


class Department(models.Model):
    title = models.CharField(max_length=16)
    objects = models.Manager()


#   修改这个类，然后运行两个命令 就可以 修改表
# .\manage.py makemigrations
# .\manage.py migrate

# UserInfo.object.create(name='sss')
